Skip to content

fix(svs): allow all-clear SVS_FLAT bitsets and register raw VAMANA#1603

Merged
sre-ci-robot merged 1 commit into
mainfrom
fix-svs-flat-allow-allclear-bitset
Apr 29, 2026
Merged

fix(svs): allow all-clear SVS_FLAT bitsets and register raw VAMANA#1603
sre-ci-robot merged 1 commit into
mainfrom
fix-svs-flat-allow-allclear-bitset

Conversation

@jamesgao-jpg
Copy link
Copy Markdown
Collaborator

@jamesgao-jpg jamesgao-jpg commented Apr 24, 2026

What

This PR makes two targeted SVS fixes:

  1. Change SvsFlatIndexNode::Search's guard from
if (!bitset.empty()) {
    return ... not_implemented ... "SVS Flat does not support bitset filtering";
}

to

if (!bitset.empty() && bitset.count() > 0) {
    return ... not_implemented ...
}

so an allocated-but-all-clear bitset is treated as an unfiltered search.

  1. Add the missing raw SVS_VAMANA registration in src/index/svs/svs_vamana.cc:
KNOWHERE_MOCK_REGISTER_DENSE_FLOAT_ALL_GLOBAL(SVS_VAMANA, SvsVamanaIndexNode, knowhere::feature::NONE)

This matches the existing Type() implementation and the existing SVS_VAMANA_LVQ / SVS_VAMANA_LEANVEC registrations.

BitsetView::count() (include/knowhere/bitsetview.h:50) returns the number of filtered-out bits / ids — 0 for an all-clear bitset even when empty() is false — so the new SVS_FLAT check is cheap and does not walk the bitmap.

Why

These are two separate SVS correctness issues surfaced by vecTool nightly coverage:

  • SVS_FLAT bitset semantics: downstream callers can pre-allocate a BitsetView matching the base-set size and leave all bits clear for plain kNN. Before this PR, SVS_FLAT rejected that semantic no-op bitset immediately instead of searching.
  • Raw SVS_VAMANA factory registration: remote Knowhere source defined INDEX_SVS_VAMANA and SvsVamanaIndexNode, but only registered SVS_VAMANA_LVQ and SVS_VAMANA_LEANVEC in the SVS registration block. That leaves raw SVS_VAMANA constructible in code but missing from the global registration path.

Evidence from vecTool nightly

Running vecTool's L2 SVS smoke on zilliztech/vecTool@newNightly with WITH_SVS=ON:

  • Before the SVS_FLAT guard fix: all 6 SVS_FLAT groups (cohere_1m × fp32/fp16/bf16 and qwen3vl_200k × fp32/fp16/bf16) fail identically at search with:
E index_wrapper.cpp:168] Failed to search with index: SVS Flat does not support bitset filtering
E knowhere_search.cpp:145] Knowhere search failed: std::exception
  • After the SVS_FLAT guard fix in a local build: those 6 groups return search results normally.

For raw SVS_VAMANA, the remote GitHub source showed the registration gap directly:

  • src/index/svs/svs_vamana.cc returned INDEX_SVS_VAMANA from Type() but only registered SVS_VAMANA_LVQ and SVS_VAMANA_LEANVEC in the registration block.

Context: zilliztech/vecTool#21.

Test plan

  • Build Knowhere with the updated svs_flat.cc and svs_vamana.cc
  • Verify SVS_FLAT accepts all-clear bitsets and still rejects bitsets with filtered entries
  • Verify the source diff now includes raw SVS_VAMANA registration alongside LVQ and LeanVec

Semantics check

  • bitset.empty() == true → short-circuit evaluation, falls through (unchanged)
  • bitset.empty() == false && bitset.count() == 0 → falls through (new fast-path, matches other index families)
  • bitset.empty() == false && bitset.count() > 0 → same not_implemented return as today (unchanged)

Scope

This PR does not address vecTool nightly policy choices such as which svs_search_window_size values the downstream matrix runs. It only fixes the Knowhere-side SVS_FLAT bitset semantics and the missing raw SVS_VAMANA registration.

Signed-off-by: jamesgao-jpg james.gao@zilliz.com

@mergify
Copy link
Copy Markdown

mergify Bot commented Apr 24, 2026

@jamesgao-jpg 🔍 Important: PR Classification Needed!

For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:

  1. If you're fixing a bug, label it as kind/bug.
  2. For small tweaks (less than 20 lines without altering any functionality), please use kind/improvement.
  3. Significant changes that don't modify existing functionalities should be tagged as kind/enhancement.
  4. Adjusting APIs or changing functionality? Go with kind/feature.

For any PR outside the kind/improvement category, ensure you link to the associated issue using the format: “issue: #”.

Thanks for your efforts and contribution to the community!.

Before: any non-empty BitsetView passed to SvsFlatIndexNode::Search()
caused an immediate `not_implemented` return, even when every bit was
zero (i.e. no vectors filtered out). Callers that pre-allocate a bitset
for shape consistency -- e.g. the vecTool nightly harness always passes
a bitset whose size matches the base set but leaves it all-clear for
plain kNN -- would see every SVS_FLAT search fail at the first query.

After: reject only when the bitset is both non-empty AND has at least
one bit set. All-clear bitsets fall through to the non-bitset search
path, which is the correct semantic for "no filtering requested".

`BitsetView::count()` (include/knowhere/bitsetview.h:50) returns the
number of filtered-out bits / ids, so the added `&& bitset.count() > 0`
is cheap and doesn't scan the bitmap.

Also register raw `SVS_VAMANA` in the SVS registration block so the
factory can construct it, matching the existing `Type()` implementation
and the LVQ / LeanVec registrations in the same file.

No regression on the actual-filter case: when the caller does have bits
set, we still surface the same not_implemented error with the same
message string, matching the current behavior.

Fixes one of the class of failures seen when running the vecTool
newNightly L2 SVS smoke benchmark (all 6 SVS_FLAT groups across
cohere_1m + qwen3vl_200k x {fp32, fp16, bf16} previously failed
identically at search stage; HNSW siblings on the same group IDs
passed). See zilliztech/vecTool#21 for the upstream discussion.

Signed-off-by: jamesgao-jpg <james.gao@zilliz.com>
@jamesgao-jpg jamesgao-jpg force-pushed the fix-svs-flat-allow-allclear-bitset branch from d6535cb to b0d5929 Compare April 27, 2026 09:21
@jamesgao-jpg jamesgao-jpg changed the title fix(svs_flat): accept all-clear bitset as unfiltered search fix(svs): allow all-clear SVS_FLAT bitsets and register raw VAMANA Apr 27, 2026
@alexanderguzhva
Copy link
Copy Markdown
Collaborator

@jamesgao-jpg I'm not sure whether e2e-sse keeps on running...

@mergify
Copy link
Copy Markdown

mergify Bot commented Apr 28, 2026

@jamesgao-jpg e2e jenkins job failed, comment /run-e2e-sse can trigger the job again.

1 similar comment
@mergify
Copy link
Copy Markdown

mergify Bot commented Apr 28, 2026

@jamesgao-jpg e2e jenkins job failed, comment /run-e2e-sse can trigger the job again.

@alexanderguzhva
Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@sre-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexanderguzhva, jamesgao-jpg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@alexanderguzhva
Copy link
Copy Markdown
Collaborator

issue: #1585
/kind improvement

@sre-ci-robot sre-ci-robot merged commit c7ad686 into main Apr 29, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants